package cn.fanyamin.util.reflect;

import java.lang.reflect.Method;

/**
 * @author walter
 *
 */
public class BeanFactory {
	public static Object createBean(String className, String factoryMethod) throws Exception {
		Class<?> cls = Class.forName(className);
		if(null == factoryMethod) {
			return cls.newInstance();
		}
		Method method = cls.getMethod(factoryMethod, new Class[0]);
		return method.invoke(cls, new Object[0]);		
	}
}
